import requestRemarksRepository from '@/repositories/requestRemarks'
import dateHelper from '@/common/js/dateHelper'

const addOneRequestRemarks = async (requestRemarks) => {
  let result = await requestRemarksRepository.addOneRequestRemarks(requestRemarks)
  return result[0]
}

const getRequestRemarksByRefNo = async (refNo) => {
  let result = await requestRemarksRepository.getRequestRemarksByRefNo(refNo)
  result.forEach(item => {
    item.createdAt = dateHelper.formatDate(item.createdAt)
  })
  let requestRemarks = result
  return requestRemarks
}

export default {
  addOneRequestRemarks: addOneRequestRemarks,
  getRequestRemarksByRefNo: getRequestRemarksByRefNo
}
